//
//  FacilityItemView.swift
//  MapVer
//
//  Created by 康凯 on 22/06/2017.
//  Copyright © 2017 康凯. All rights reserved.
//

import UIKit
import SnapKit

let k_deviceItemLabelHeight: CGFloat = 44
let k_deviceItemImageCellHeight: CGFloat = 65
let k_labelFont: UIFont = UIFont.systemFont(ofSize: is_iPhone_5_orLess ? 15 : 16)
// MARK:- title - content 类型的cell
class YZFetterDetailItemCell: UITableViewCell {
    
    private var titleLabel: UILabel!
    private var detailLabel: UILabel!
    
    override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
        super.init(style: .default, reuseIdentifier: reuseIdentifier)
        _initSubviews()
    }
    
    var title: String!{
        willSet{ titleLabel.text = newValue }
    }
    
    var detail: String!{
        willSet{ detailLabel.text = newValue }
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    private func _initSubviews() {
        backgroundColor = UIColor.white
        
        // title
        titleLabel = UILabel()
        titleLabel.textColor = UIColor.init(rgbHex: "959599")
        titleLabel.text = "设备状态"
        titleLabel.numberOfLines = 2
        titleLabel.font = k_labelFont
        self.addSubview(titleLabel)
        titleLabel.snp.makeConstraints{
            $0.left.equalTo(self).offset(10)
            $0.centerY.equalTo(self)
            $0.width.equalTo(100)
            $0.height.equalTo(k_deviceItemLabelHeight)
        }
        
        // content
        detailLabel = UILabel()
        detailLabel.text = "2017年06月26日 09:19:22"
        detailLabel.font = titleLabel.font
        detailLabel.textAlignment = .right
        detailLabel.lineBreakMode = .byCharWrapping
        self.addSubview(detailLabel)
        detailLabel.snp.makeConstraints{
            $0.left.equalTo(titleLabel.snp.right).offset(is_iPhone_5_orLess ? 5 : 8)
            $0.right.equalTo(self).offset(-10)
            $0.centerY.equalTo(self)
        }
    }
}
